package exam.honor8;

import java.util.Scanner;

public class ex2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String next = scanner.next();
        int L = scanner.nextInt();
        String[] split = next.split(",");

        int first = 0;
        int nsize = 0;
        for (int i = 0; i < split.length; i++) {
            nsize+=split[i].length();
            //数量超过L
            if(nsize>L){
                //单词数量,字母数量
                int num = i-first;
                int anum = nsize-split[i].length();
                if(num==1){
                    System.out.print(split[first]);
                    for (int j = 0; j < L-anum; j++) {
                        System.out.print("*");
                    }
                    System.out.println();
                }else{
                    int base = (L-anum)/num;
                    int left = (L-anum)%num;
                    for (int j = first; j < i; j++) {
                        System.out.print(split[j]);
                        for (int k = 0; k < base; k++) {
                            System.out.print("*");
                        }
                        if(left!=0){
                            System.out.print("*");
                            left--;
                        }
                    }
                    System.out.println();
                }
                //判断逻辑结束
                first=i;
                nsize=split[i].length();
            }
        }

    }
}
